
<script>
$(document).ready(function(){

	jQuery.widget('ui.dialog', jQuery.extend({}, jQuery.ui.dialog.prototype, {_title: function(titleBar) {titleBar.html(this.options.title || '&#160;');}}));

	$("#dialogSaveChanges").dialog({
	      modal: true,
	      draggable: false,
	      resizable: false,
	      title:'<img src="pages/images/themed/portalHeaderIcon.gif" width="12" height="12"/> &nbsp; Save Changes Confirmation',
	      disabled:true,
	      closeOnEscape: false,
	      autoOpen: false,
	      show:"blind",
	      width:300,
	      height:150,
	      open: function(event, ui) {$(this).parent().children().children('.ui-dialog-titlebar-close').hide();},
	      buttons: {"Confirm": function() {$(this).dialog('close'); saveRecord();},
	                "Cancel": function() {$(this).dialog('close');}}
  });

	$("#dialogDelete").dialog({
	      modal: true,
	      draggable: false,
	      resizable: false,
	      title:'<img src="pages/images/themed/portalHeaderIcon.gif" width="12" height="12"/> &nbsp; Delete Confirmation',
	      disabled:true,
	      closeOnEscape: false,
	      autoOpen: false,
	      show:"blind",
	      width:300,
	      height:150,
	      open: function(event, ui) {$(this).parent().children().children('.ui-dialog-titlebar-close').hide();},
	      buttons: {"Confirm": function() {$(this).dialog('close'); deleteRecord();},
	                "Cancel": function() {$(this).dialog('close');}}
  });

	$("#dialogBeforeNavigation").dialog({
	      modal: true,
	      draggable: false,
	      resizable: false,
	      title:'<img src="pages/images/themed/portalHeaderIcon.gif" width="12" height="12"/> &nbsp; Navigate Away Confirmation',
	      disabled:true,
	      closeOnEscape: false,
	      autoOpen: false,
	      show:"blind",
	      width:300,
	      height:150,
	      open: function(event, ui) {$(this).parent().children().children('.ui-dialog-titlebar-close').hide();},
	      buttons: {"Confirm": function() {$(this).dialog('close'); submitNavigation($('#tabUrlClicked').val(), 'false', 'false', 'false');},
	                "Cancel": function() {$(this).dialog('close');}}
	});

	$("#dialogResetPassword").dialog({
	      modal: true,
	      draggable: false,
	      resizable: false,
	      title:'<img src="pages/images/themed/portalHeaderIcon.gif" width="12" height="12"/> &nbsp; Reset Password Confirmation',
	      disabled:true,
	      closeOnEscape: false,
	      autoOpen: false,
	      show:"blind",
	      width:300,
	      height:165,
	      open: function(event, ui) {$(this).parent().children().children('.ui-dialog-titlebar-close').hide();},
	      buttons: {"Confirm": function() {$(this).dialog('close'); resetPassword();},
	                "Cancel": function() {$(this).dialog('close');}}
});
});

function checkErrorsForSaveChangesDialog()
{
  if ($("#errorCount").val() == 0)
  {
    $('#dialogSaveChanges').css("display", "block").css("visibility", "visible").dialog('open');
  }
}

function openDeleteDialog()
{
  $('#dialogDelete').css("display", "block").css("visibility", "visible").dialog('open');
}

function openBeforeNavigationDialog(tabUrlClicked)
{
  if ($("#changeCount").val() != 0)
  {
    $('#tabUrlClicked').val(tabUrlClicked);
    $('#dialogBeforeNavigation').css("display", "block").css("visibility", "visible").dialog('open');
  }
  else
  {
    self.close();
  }
}

function openResetPasswordDialog()
{
  $('#dialogResetPassword').css("display", "block").css("visibility", "visible").dialog('open');
}

function saveRecord()
{
  $("#adminCommand\\.adminRequestedAction").val('save');
  $("#adminForm").submit();
}

function deleteRecord()
{
  $("#adminCommand\\.adminRequestedAction").val('delete');
  $("#adminForm").submit();
}

function resetPassword()
{
  $("#adminCommand\\.adminRequestedAction").val('resetPassword');
  $("#adminForm").submit();
}
</script>

<div id="dialogSaveChanges" style="display:none;visibility:hidden;">
  <p>
    <span class="ui-icon ui-icon-help" style="float:left; margin:0 7px 70px 0;"></span>
    Are you sure you would like to save the current changes?
  </p>
</div>

<div id="dialogDelete" style="display:none;visibility:hidden;">
  <p>
    <span class="ui-icon ui-icon-help" style="float:left; margin:0 7px 70px 0;"></span>
    Are you sure you would like to delete the current record?
  </p>
</div>

<div id="dialogBeforeNavigation" style="display:none;visibility:hidden;">
  <p>
    <span class="ui-icon ui-icon-help" style="float:left; margin:0 7px 70px 0;"></span>
    Are you sure you would like to navigate away from this page and discard the current changes?
  </p>
</div>

<div id="dialogResetPassword" style="display:none;visibility:hidden;">
  <p>
    <span class="ui-icon ui-icon-help" style="float:left; margin:0 7px 20px 0;"></span>
    Are you sure you would like to reset the password and force the user to enter a new one upon next login?
  </p>
</div>
